package com.yikome.order.enums;

public enum Payment {

	PAYMENT_COD(1 , "货到付款") , 
	
	PAYMENT_STRIPE(2 , "STRIPE");
	
	
	private int code ; 
	private String name ;
	
	private Payment (int code , String name) {
		this.code = code; 
		this.name = name;
	}

	public int getCode() {
		return code;
	}

	public String getName() {
		return name;
	}
	
	public static Payment name(int code) {
		Payment[] payments = Payment.values();
		for (Payment payment : payments) {
			if(payment.getCode() == code) {
				return payment;
			}
		}
		return null;
	}
}
